/**
 * 接口
 *
 * @Author: baiyuxin
 * @Date: 2019-9-23
 * @Last Modified by:   baiyuxin
 * @Last Modified time: 2019-9-23 14:35:22
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

//OEM端

//查询全部列表（自定义数据过滤）@1
export const findPage = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach`,{params,menuId:'-1'});

export const findPage4Serv = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/service`,{params,menuId:'-1'});

export const getAllList = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/allList`,{params,menuId:'-1'});

export const getDetails = (id,params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/${id}`,{params});

export const getChangeDetails = (id,params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttachLog/${id}`,{params});

//导出
export const downloadExcel = params => {
    params = Object.assign(params,{menuId:'-1'});
    return axios({
        url:`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/export/excel`,
        method:'get',
        params:params,
        responseType: 'blob',
        //10分钟
        timeout:(10*1000)*60
    });
};

//导入确认
export const importConfirmSalesZone = params =>
  axios.post(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/import/confirm/salesZone`, params);

//导出销售授权区域模板
export const exportSalesZoneModel = () =>
  axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/export/salesZoneModel`, {
    responseType: 'arraybuffer'
  });
//经销商基础信息维护导出
export const getDealerListForExport = (params) => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerMessageExport`, params,{
  responseType: 'blob'
});
//服务站基础信息维护导出
export const getServeListForExport = (params) => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/serveMessageExport`, params,{
  responseType: 'blob'
});

//获取经销商公司信息
export const getCompany = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/CompanyInfo/getCompany`, {params});
//下发到DMS
export const sendDealerInfo = ids => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/dmsInner/dealerInfo/${ids}`);
//下发到APP
export const sendApp = ids => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/dealerToApp/sendToAppBatch/${ids}`);
//下发备件中心
export const sendPartSap = ids => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/dealerAttach/rfc/sendDealer2PartSapBatch/${ids}`);
